package com.belazy.library.model.request;

import io.swagger.annotations.ApiModelProperty;


/**
 * @Description <p> 分页表单数据模型 </p>
 * @Author chupeng.tang
 * @CreateTime 2023/5/19 17:29
 * @Version 1.0
 */
public abstract class PageRequest extends ListRequest {
    @ApiModelProperty("页容量(页条数)")
    private Long size;
    @ApiModelProperty("页码偏移量(页码)")
    private Long offset;

    public void setSize(Long size) {
        this.size = size;
    }

    public void setOffset(Long offset) {
        this.offset = offset;
    }

    public Long getSize() {
        if (size <= 0) {
            return 10L;
        }
        return size;
    }

    public Long getOffset() {
        if (offset <= 0) {
            return 1L;
        }
        return offset;
    }

    @Override
    public String toString() {
        return "PageDTO{" +
                "size=" + size +
                ", offset=" + offset +
                '}';
    }
}
